﻿using System.Windows;
using Microsoft.Phone.Scheduler;
using Microsoft.Phone.Info;
using Microsoft.Phone.Shell;
using System;
using Phone.Framework.Config;

namespace CetWin.Tasks
{
    public class ScheduledAgent : ScheduledTaskAgent
    {

        private SettingManager _sm;

        public ScheduledAgent()
        {
            _sm = new SettingManager();
        }

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            string toastTitle = "CetWin";

            string toastMessage = "复习时间到了 ^_^";
            ShellToast toast = new ShellToast();
            toast.Title = toastTitle;
            toast.Content = toastMessage;
            toast.Show();

            //ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(15));
            NotifyComplete();
        }
    }
}